#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <ctype.h>
#include <stdint.h>

#define MIN(a, b)	((a) < (b) ? (a) : (b))

#define GET_BIT(a, i)	(((a) >> (i)) & 1)
#define SET_BIT(a, i)	((a) |= (1 << (i)))
#define UNSET_BIT(a, i)	((a) &= ~(1 << (i)))

static void
print_bin(uint32_t n)
{
	int i = 31;

	while (i >= 0)
		(void) fprintf(stderr, "%d", abs((n>>i--) % 2));
	fputc('\n', stderr);
}

static uint32_t
shift(uint32_t in, uint32_t bits)
{
	short bit_sum = 0;
	register short i;

	for (i = 0; i <= 31; i++)
		if (GET_BIT(bits, i))
			bit_sum ^= GET_BIT(in, i);

	in >>= 1;
	bit_sum ? SET_BIT(in, 31) : UNSET_BIT(in, 31);
	//print_bin(in);

	return in;
}

int
main(int argc, char **argv)
{
	static int n, m;
	uint32_t x = 0, bits = 0;
	int i, t;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &t);
		SET_BIT(bits, t);
	}
	//fprintf(stderr, "bits=0x%X\n", bits);
	scanf("%u%d", &x, &m);
	print_bin(x);

	for (i = 0; i < m; i++)
		printf("%u\n", x = shift(x, bits));

	return 0;
}
